package com.ftqh.project.travel.notes.service;

import com.ftqh.project.travel.notes.entity.NoteImage;
import com.ftqh.project.travel.notes.repository.NoteImageRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

/**
 * Created by Administrator on 2017/5/11.
 */
@Service
public class NoteImageServiceImpl implements NoteImageService{
    @Autowired
    NoteImageRepository noteImageRepository;

    @Override
    public NoteImage save(NoteImage noteImage) {
        noteImageRepository.save(noteImage);
        return noteImage;
    }

    @Override
    public Optional<NoteImage> findById(Long id) {
        return Optional.of(noteImageRepository.findOne(id));
    }

    @Override
    public void updateNoteId(Long id, Long noteId) {
        noteImageRepository.updateNoteId(id,noteId);
    }
}
